<%@ page pageEncoding="UTF-8"%>
<%@ include file="/common/validate.jsp"%>
<%
    String id = input.getDesc("id", "");
    id = "725b9fd08e5b798e73a688c4984f7e95";
    // 查询医生的新闻信息,一个医院为医生开通特定的新闻类型
    String _branch = "ys" + id; // 由ks + doctorId组成
    String selectContent = "new map(n.id as id , n.newsId as news_id, n.url as url, n.title as title, n.summary as summary, n.time as time, n.img as img, n.jsonString as json, n.tag as tag, n.category as category)";
    List<Map> labels = QBuilder.db("basedb").select("new map(type as label_id, name as name, content as content, queue as queue, icon as icon, parent as parent, jsonString as json, branch as branch)").from("Label").where(new Where("hospital =", hospital).and("status = ", STATUS_ENABLE).and("category=", 4)).query().getResultObj();
    for (int i = 0; i < labels.size(); i++) {
        Map _map = labels.get(i);
        _map.put("branch", _branch);
        Integer labelId = Tools.getInt(_map.get("label_id") + "", -1111);
        List<Map> newsList = QBuilder.db("basedb").select(selectContent).from("News n").where(new Where("n.hospital=", hospital).and("n.status = ", STATUS_ENABLE).and("n.branch=", _branch).and("n.category=", labelId)).order("n.newsId", "desc").page(3, 1).query().getResultObj();
        _map.put("news", newsList);
    }
    msg.put("data", labels);
    Tools.encryptPrint(out, msg.toJson());
%>
